package main

import "log"

func processRequest(userID int) {
	// 闭包形式打印执行函数的起止时间
	defer trace("processRequest", userID)()
}

func trace(name string, args ...interface{}) func() {
	log.Printf("ENTER %s(%v)\n", name, args)
	return func() {
		log.Printf("EXIT %s", name)
	}
}

func main() {
	processRequest(123)
}
